package o;

import android.content.Intent;
import android.net.Uri;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.BuoyLoginAction;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.OpenWebViewAction;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.ACTION;
import java.util.HashMap;

public class bga {
    private static bga ˎ;
    private HashMap<String, Object> ˊ = new HashMap();
    private fad ˏ;
    private GameInfo ॱ;

    public static synchronized bga ॱ() {
        bga o_bga;
        synchronized (bga.class) {
            if (ˎ == null) {
                ˎ = new bga();
            }
            o_bga = ˎ;
        }
        return o_bga;
    }

    public void ˋ(GameInfo gameInfo, fad o_fad) {
        this.ॱ = gameInfo;
        this.ˏ = o_fad;
    }

    public void ˊ(GameInfo gameInfo, String str, fad o_fad, boolean z) {
        if (gameInfo == null) {
            gameInfo = this.ॱ;
        }
        if (o_fad == null) {
            o_fad = this.ˏ;
        }
        if (gameInfo != null && o_fad != null) {
            String str2 = !z ? "buoy:" + gameInfo.getPackageName() + str : gameInfo.getPackageName() + str;
            Object ˎ = ˎ(gameInfo, str);
            if (ˎ == null) {
                ˊ(null, o_fad);
            }
            this.ˊ.put(str2, ˎ);
            ˊ(str2, o_fad);
        }
    }

    public void ˎ(GameInfo gameInfo, Class<?> cls, Intent intent, fad o_fad) {
        if (gameInfo == null) {
            gameInfo = this.ॱ;
        }
        if (o_fad == null) {
            o_fad = this.ˏ;
        }
        if (gameInfo != null && o_fad != null && cls != null) {
            String str = gameInfo.getPackageName() + cls.getSimpleName();
            if (intent == null) {
                ˊ(null, o_fad);
            }
            this.ˊ.put(str, intent);
            ˊ(str, o_fad);
        }
    }

    public void ˏ(GameInfo gameInfo, Class<?> cls, fad o_fad) {
        if (gameInfo == null) {
            gameInfo = this.ॱ;
        }
        if (o_fad == null) {
            o_fad = this.ˏ;
        }
        if (gameInfo != null && o_fad != null && cls != null) {
            String str = gameInfo.getPackageName() + cls.getSimpleName();
            this.ˊ.put(str, new Intent(ContentManager.getInstant().getContext(), cls));
            ˊ(str, o_fad);
        }
    }

    public void ॱ(GameInfo gameInfo, Class<?> cls, Object obj, fad o_fad, boolean z) {
        if (gameInfo == null) {
            gameInfo = this.ॱ;
        }
        if (o_fad == null) {
            o_fad = this.ˏ;
        }
        if (gameInfo != null && o_fad != null) {
            String simpleName;
            if (cls != null) {
                simpleName = cls.getSimpleName();
            } else if (obj instanceof Intent) {
                simpleName = ((Intent) obj).getAction();
            } else if (obj instanceof cjm) {
                simpleName = ((cjm) obj).ॱ().getAction();
            } else if (obj instanceof fjb) {
                simpleName = obj.toString();
            } else {
                simpleName = null;
            }
            if (simpleName == null) {
                Logger.e("BuoyUriProvider", "the activity and action is null");
                return;
            }
            simpleName = !z ? "buoy:" + gameInfo.getPackageName() + simpleName : gameInfo.getPackageName() + simpleName;
            if (obj == null) {
                ˊ(null, o_fad);
                return;
            }
            this.ˊ.put(simpleName, obj);
            ˊ(simpleName, o_fad);
        }
    }

    public boolean ˎ(String str) {
        return false;
    }

    public Object ˊ(String str) {
        if (str == null) {
            Logger.e("BuoyUriProvider", "the [taskId] is null");
            return null;
        } else if (this.ˊ == null || this.ˊ.size() <= 0) {
            Logger.e("BuoyUriProvider", "the [taskMap] is null");
            return null;
        } else if (!this.ˊ.containsKey(str)) {
            return null;
        } else {
            Object obj = this.ˊ.get(str);
            this.ˊ.remove(str);
            return obj;
        }
    }

    public ezh ˏ(String str) {
        return new ezh(this.ॱ, str);
    }

    private Object ˎ(GameInfo gameInfo, String str) {
        String[] split = str.split("\\|");
        String str2 = "";
        str2 = "";
        if (split.length != 2) {
            return null;
        }
        str2 = split[0];
        String str3 = split[1];
        int i = -1;
        switch (str2.hashCode()) {
            case -1010580219:
                if (str2.equals("openId")) {
                    i = 4;
                    break;
                }
                break;
            case 96801:
                if (str2.equals("app")) {
                    i = 1;
                    break;
                }
                break;
            case 3213227:
                if (str2.equals("html")) {
                    i = 0;
                    break;
                }
                break;
            case 103149417:
                if (str2.equals("login")) {
                    i = 5;
                    break;
                }
                break;
            case 415263227:
                if (str2.equals("secondcattags")) {
                    i = 2;
                    break;
                }
                break;
            case 1001998385:
                if (str2.equals("waplinkdetail")) {
                    i = 3;
                    break;
                }
                break;
        }
        switch (i) {
            case 0:
                return ˊ(gameInfo, str3);
            case 1:
            case 2:
            case 3:
                return ˋ(str);
            case 4:
                return ᐝ(str3);
            case 5:
                return ॱ(str3);
            default:
                return ʻ(str3);
        }
    }

    private Intent ˊ(GameInfo gameInfo, String str) {
        Intent intent = new Intent();
        intent.setAction(OpenWebViewAction.OPEN_WEBVIEW_ACTION);
        intent.putExtra("url", str);
        return intent;
    }

    private cjm ˋ(String str) {
        cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
        appDetailActivityProtocol.ˏ(new Request());
        appDetailActivityProtocol.ॱ().ˋ(str);
        return new cjm("appdetail.activity", appDetailActivityProtocol);
    }

    private Intent ॱ(String str) {
        Intent intent = new Intent(ContentManager.getInstant().getContext(), TransferActivity.class);
        intent.setAction(BuoyLoginAction.ACTION_GAME_LOGIN);
        intent.putExtra("loginParam", str);
        return intent;
    }

    private cjm ᐝ(String str) {
        Object obj = -1;
        switch (str.hashCode()) {
            case 1606:
                if (str.equals("28")) {
                    obj = null;
                    break;
                }
                break;
        }
        switch (obj) {
            case null:
                return new cjm("market.activity", null);
            default:
                return null;
        }
    }

    private Intent ʻ(String str) {
        try {
            return new Intent(ACTION.HWID_SCHEME_URL, Uri.parse(str));
        } catch (Exception e) {
            Logger.ˋ("BuoyUriProvider", "parse url exception");
            return null;
        }
    }

    private void ˊ(String str, fad o_fad) {
        if (o_fad != null) {
            if (str == null) {
                Logger.e("BuoyUriProvider", "the task Id is null");
                return;
            }
            try {
                o_fad.ˎ(str);
            } catch (Throwable e) {
                Logger.ˋ("BuoyUriProvider", "RemoteException", e);
            }
        }
    }
}
